<template>
  <div class="content_box">
    <p class="img">
      <img src="https://tpp-admin.oss-cn-beijing.aliyuncs.com/rich/20240102/DvqeyzFAek2RT0mNP7gL.png" alt="">
    </p>
    <div class="logo_box">
      <p class="logo">
        <img src="https://tpp-admin.oss-cn-beijing.aliyuncs.com/rich/20231224/9zPeY1zWATxXrPkEmX5V.jpg" alt="">
      </p>
    </div>
  </div>
</template>

<script>
import { 
  getToken,
} from "@/utils/auth";
import { getUserPhone,setUserProfile } from "@/api/index";
export default {
  data() {
    return {
      statusBarHeight: "", // 状态栏高度
      titleBarHeight: "", // 标题栏高度
      navBarHeight: "", // 导航栏总高度
    };
  },
  methods: {
    getUserToken(){
      if(!getToken()){
        wx.login({
          success:(res)=>{
            let code = res.code
            this.$store.dispatch("userLogin", code).then(res=>{
              if(res.statusCode == '00000'){
                console.log('ooooo')
                setTimeout(() => {
                  wx.switchTab({
                    url: '/pages/home/main',
                  })
                }, 1000);
              }
            })
          }
        })
      }else{
        setTimeout(() => {
          wx.switchTab({
            url: '/pages/home/main',
          })
        }, 1000);
      }
    },
  },
  onShow(){
    this.getUserToken()
  },
  onLoad(options) {
    
  },
  beforeMount() {
    const self = this;
    wx.getSystemInfo({
      success(system) {
        console.log(`system:`, system);
        self.statusBarHeight = system.statusBarHeight;
        let platformReg = /ios/i;
        if (platformReg.test(system.platform)) {
          self.titleBarHeight = 44;
        } else {
          self.titleBarHeight = 48;
        }
        self.navBarHeight = self.statusBarHeight + self.titleBarHeight;
      },
    });
  },
};
</script>

<style lang="scss" scoped>
.content_box {
  min-height: 100vh;
  .img{
    text-align: center;
    position: fixed;
    top:22%;
    width: 100%;
    img{
      width: 400rpx;
      height: 420rpx;
      margin:0 auto;
    }
  }
  .logo_box{
    width: 100%;
    position: fixed;
    bottom:150rpx;
    .logo{
      width: 482rpx;
      margin:0 auto;
      img{
        width: 100%;
        height: 114rpx;
      }
    }
  }
}

</style>